import socket

# 创建socket对象
sk = socket.socket()
# 绑定ip和端口号
sk.bind(('0.0.0.0', 8081))
# 设置监听
sk.listen(5)

# 等待客服端连接
conn,addr = sk.accept()

print(conn,addr)

while True:
    accept_data = sk.recv(1024)
    print("收到客服端的消息",accept_data.encode("utf-8"))
    sk.send("收到".encode("utf-8"))